package com.kstech.mp3604.ui.startBoot

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.blankii.androidlibrary.exts.loge

class BootReceiver : BroadcastReceiver() {
    private val TAG="BootReceiver"
    override fun onReceive(context: Context?, intent: Intent?) {
        if (Intent.ACTION_BOOT_COMPLETED == intent?.action) {
            // 启动我们的应用


            val launchIntent =
                context!!.packageManager.getLaunchIntentForPackage(context.packageName)

            "收到广播-------${context.packageName}".loge(TAG)
            launchIntent!!.flags = Intent.FLAG_ACTIVITY_NEW_TASK;
            context.startActivity(launchIntent);
        }
    }

}